<?php
	if(isset($_POST['postLoad'])){
		$postLoad = Mres($_POST['postLoad']);
		
		switch($postLoad){
			case "sendingMessage":
				$to = $_POST["sendingTo"];
				$message = $_POST["txtMessage"];
				$attachment = $_FILES["messageAttachment"];
				
				//$messageSentFeedback = sendMessage($to, $message, $attachment, $userID);
				
				$toArray = explode('_', $to);
				
				echo count($toArray);
				
				die();

				if($messageSentFeedback === true){
					?>
					<script>
					$(document).ready(function(){
						Popup('Messages | Inbox', 'messages/inbox', 0);
					});
					</script>
					<?php
				} else {
					?>
					<input type="hidden" id="messageSendingToPost" value="<?php echo $to; ?>" />
					<input type="hidden" id="messageTextPost" value="<?php echo $message; ?>" /> 
					<input type="hidden" id="messageSendingError" value="<?php echo $messageSentFeedback; ?>" />
					<script>
					$(document).ready(function(){
						Popup('Messages | New message', 'messages/createNewMessage', 0);
					});
					</script>
					<?php
				}
				
			break;
		}
	}
?>